﻿@model PersonalWebsite.Models.Contact

@{
    ViewBag.Title = "Edit";
}

<h2>Edit</h2>

@using (Html.BeginForm()) {
    @Html.AntiForgeryToken()
    @Html.ValidationSummary(true)

    <fieldset>
        <legend>Contact</legend>

        @Html.HiddenFor(model => model.ContactID)

        <div class="editor-label">
            @Html.LabelFor(model => model.ContactName)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.ContactName)
            @Html.ValidationMessageFor(model => model.ContactName)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.EMail)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.EMail)
            @Html.ValidationMessageFor(model => model.EMail)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Details)
        </div>
        <div class="editor-field">
            @Html.TextAreaFor(model => model.Details)
            @Html.ValidationMessageFor(model => model.Details)
        </div>

        <p>
            <input type="submit" value="Save" />
        </p>
    </fieldset>
}

<div>
    @Html.ActionLink("Back to List", "Index")
</div>

<script>
    var textBoxes = document.getElementsByClassName("text-box");
    for (var i = 0; i < textBoxes.length; i++) {
        textBoxes[i].style.width = "100%";
        textBoxes[i].style.height = "25px";
        textBoxes[i].className += " layui-input";
    }

    var textAreas = document.getElementsByTagName("textarea");
    for (var i = 0; i < textAreas.length; i++) {
        textAreas[i].className += " layui-textarea";
    }
</script>